using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CollegeShop.Infrastructure.Entities.Repository;

namespace CollegeShop.Infrastructure.Entities.Entity
{
    public class Issue : IAccessible<T_Issue, Issue>, ILogicEntity<T_Issue, Issue>
    {
        public int ID { get; set; }

        public string IssueNumber { get; set; }

        public int SumAmount { get; set; }

        public decimal SumSaleMoney { get; set; }

        public int SalesUnitID { get; set; }

        public string CreateUser { get; set; }

        public DateTime CreateTime { get; set; }

        public string DeliveryUser { get; set; }

        public string DeliveryPhone { get; set; }

        public string ReceivedUser { get; set; }

        public DateTime ReceivedTime { get; set; }

        public int State { get; set; }

        public string Remark { get; set; }

        protected override void Covariant(T_Issue model)
        {
            if (model != null)
            {
                    this.ID = model.ID;
                    this.IssueNumber = model.IssueNumber;
                    this.SumAmount = model.SumAmount;
                    this.SumSaleMoney = model.SumSaleMoney;
                    this.SalesUnitID = model.SalesUnitID;
                    this.CreateUser = model.CreateUser;
                    this.CreateTime = model.CreateTime;
                    this.DeliveryUser = model.DeliveryUser;
                    this.DeliveryPhone = model.DeliveryPhone;
                    this.ReceivedUser = model.ReceivedUser;
                    this.ReceivedTime = model.ReceivedTime;
                    this.State = model.State;
                    this.Remark = model.Remark;
            }
}
        protected override T_Issue Inverter(Issue model)
        {
            if (model != null)
            {
                return new T_Issue()
                {
                    ID = model.ID,
                    IssueNumber = model.IssueNumber,
                    SumAmount = model.SumAmount,
                    SumSaleMoney = model.SumSaleMoney,
                    SalesUnitID = model.SalesUnitID,
                    CreateUser = model.CreateUser,
                    CreateTime = model.CreateTime,
                    DeliveryUser = model.DeliveryUser,
                    DeliveryPhone = model.DeliveryPhone,
                    ReceivedUser = model.ReceivedUser,
                    ReceivedTime = model.ReceivedTime,
                    State = model.State,
                    Remark = model.Remark,
                };
            }
            return null;
        }
        public Issue Set(T_Issue dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
